home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_062 / hackiconii_source / newptr.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  3KB  |  93 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
  2. * |_o_o|\\ Copyright (c) 1987 The Software Distillery.  All Rights Reserved *
  3. * |. o.| ||          Written by Doug Walker                                 *
  4. * | .  | ||          The Software Distillery                                *
  5. * | o  | ||          235 Trillingham Lane                                   *
  6. * |  . |//           Cary, NC 27511                                         *
  7. * ======             BBS:(919)-471-6436                                     *
  8. \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  9. #include "exec/types.h"
  10. #include "intuition/intuition.h"
  11.  
  12. /* defines for the sprite */
  13. #define PTR_WIDTH 16
  14. #define PTR_HEIGHT 10
  15. #define PTR_HOTX -8
  16. #define PTR_HOTY 0
  17. /***************************************************************/
  18. /*  The following array contains the sprite colors          */
  19. /***************************************************************/
  20. UWORD ptr_col[] =
  21.      { 0xfff, 0xf00, 0x000 };
  22.  
  23. /***************************************************************/
  24. /*  The following data structures contain the sprite image  */
  25. /***************************************************************/
  26. USHORT From_dat[]=  {
  27.      /*plane1  plane0 */
  28.       0x0000,  0x0000,
  29.       0x0000,  0x0100,
  30.       0x0000,  0x0380,
  31.       0x0000,  0x0540,
  32.       0x0000,  0x0100,
  33.       0xecea,  0x0000,
  34.       0x8aae,  0x0000,
  35.       0xccae,  0x0000,
  36.       0x8aaa,  0x0000,
  37.       0x8aea,  0x0000,
  38.       0x0000,  0x0000,
  39.       0x0000,  0x0000
  40.      };
  41.  
  42. USHORT To_dat[]=  {
  43.      /*plane1  plane0 */
  44.       0x0000,  0x0000,
  45.       0x0000,  0x0100,
  46.       0x0000,  0x0380,
  47.       0x0000,  0x0540,
  48.       0x0000,  0x0100,
  49.       0x0ee0,  0x0000,
  50.       0x04a0,  0x0000,
  51.       0x04a0,  0x0000,
  52.       0x04a0,  0x0000,
  53.       0x04e0,  0x0000,
  54.       0x0000,  0x0000,
  55.       0x0000,  0x0000
  56.      };
  57.  
  58. /***************************************************************/
  59. /*   The following routine will install the sprite as the   */
  60. /*   Intuition pointer. A pointer to your current window is */
  61. /*   needed as a parameter to this routine.                 */
  62. /***************************************************************/
  63. NewPtr(window, from)
  64. struct Window *window;
  65. int from;
  66. {
  67.  SHORT i;
  68.  UWORD red,green,blue;
  69.  struct ViewPort *vport;
  70.  
  71. /* Get the window's viewport address */
  72.  vport = (struct ViewPort *) ViewPortAddress(window);
  73.  
  74. /* Set the colors for the sprite */
  75. for (i=0;i<3;i++)
  76.    {
  77.      red = (ptr_col[i] & 0xf00) >> 8;
  78.      green = (ptr_col[i] & 0x0f0) >> 4;
  79.      blue  = (ptr_col[i] & 0x00f) ;
  80.      SetRGB4(vport,17+i,red,green,blue);
  81.    }
  82.  /* get rid of the previous pointer */
  83.  ClearPointer(window);
  84.  /* and install the new one */
  85.  SetPointer(window,
  86.             (from ? &From_dat : &To_dat),
  87.             PTR_HEIGHT,
  88.             PTR_WIDTH,
  89.             PTR_HOTX,
  90.             PTR_HOTY);
  91.  return(0);
  92.  }
  93.